/****************************************************************************

 Copyright (C) 2009 Jean Pierre Charalambos. All rights reserved.

 Jean Pierre Charalambos (http://dis.unal.edu.co/profesores/pierre/) is an
 Affiliate Associate Professor of the Faculty of Engineering at National
 University of Colombia (http://www.unal.edu.co/).

 This file is part of maku version 0.1.

 http://code.google.com/p/maku/
 email: jpcharalambosh@unal.edu.co

 This file may be used under the terms of the GNU General Public License 
 versions 2.0 or 3.0 as published by the Free Software Foundation and
 appearing in the COPYING file included in the packaging of this file.

 This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

*****************************************************************************/

#ifndef AUXVIEWER_H
#define AUXVIEWER_H

#include "viewer.h"

class AuxViewer : public Viewer {

  Q_OBJECT
  
  public :
    AuxViewer(Scene* const s, QWidget * parent=NULL, const int t=3, const Viewer *mainV=NULL, const QGLWidget* shareWidget=0);
    AuxViewer(Scene* const s, const QGLFormat &, QWidget * parent=NULL, const int t=3, const Viewer *mainV=NULL, const QGLWidget* shareWidget=0);

  public slots:
    virtual void adjustScene();
    void constraintRotation(bool);
    void setCameraAsInViewer();
    void slotDockVisible(bool);
    void setDrawMainCamera(bool mc) {drawMainCamera = mc; updateGL();}

  protected :
    virtual void draw();

  private :
    int                         const type;
    bool                        visible, drawMainCamera;
    WorldConstraint             *constraint;
    void alignCamera(float distance=1) {
      Vec pos((type==0)? distance : 0.0, (type==1)? distance : 0.0, (type==2)? distance : 0.0);
      camera()->setPosition( pos );
      Vec up((type==1)? 1.0 : 0.0, (type==2)? 1.0 : 0.0, (type==0)? 1.0 : 0.0);
      camera()->setUpVector( up );
      camera()->lookAt( Vec(0,0,0) );
    }
    const Viewer                *viewer;
};

//=============================================================================
#endif // AUXVIEWER_H
//=============================================================================
